const app = getApp()

Component<DataModel, {}, MethodsModel>({
  data: {
    currentPage: "",
  },
  methods: {
    changeTap(e: WechatMiniprogram.Touch) {
      const tab = e.currentTarget.dataset.page
      wx.switchTab({
        url: `/pages/${tab}/${tab}`,
      })
    },
  },

  lifetimes: {
    attached() {
      const { songName, imgUrl } = app.globalData.song
      this.setData({
        songName,
        imgUrl,
        isPlay: app.globalData.isPlay,
      })
    },
  },
})

interface DataModel {
  currentPage: "index" | "video" | "personal" | ""
}

interface MethodsModel {
  changeTap: (e: WechatMiniprogram.Touch) => void
  [key: string]: any
}

